package com.es;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;

import com.es.config.RedisConfig;

public class Test {
	public static void main(String[] args) {

		//AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(RedisConfig.class);
		//ShardedJedisPool pool = ctx.getBean("productShardPool",ShardedJedisPool.class);
		//ShardedJedis jedis = pool.getResource();
		Jedis jedis = new Jedis("192.168.0.58",7001);
		for(int i = 10000; i < 100000; i++){
			jedis.set("aa" + i, "aa" + i);
		}
		
		String memoryAllLine = jedis.info("memory");
		String usedMemoryLine = memoryAllLine.split("\r\n")[1];
		String memory = usedMemoryLine.substring(usedMemoryLine.indexOf(':') + 1);
		System.out.println(memory);
		jedis.close();
		int a = 8248576-Integer.parseInt(memory);
		System.out.println(a);
	}

}
